package com.qfedu.conntroller;

import com.qfedu.vo.ResultVo;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@ControllerAdvice
public class GlobalDefultExceptionHandler {
    //声明要捕获的异常
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public ResultVo defultExcepitonHandler(HttpServletRequest request, Exception e) {
        return ResultVo.getExceptionResultVo("网络异常",null);
    }
}